<div ng-controller="CarDetailCtrl as vm">
    <h1 class="page-title">查看车辆</h1>
    <div class="btn-toolbar" ng-show="vm.loadDone && userRole!='shipper'">
        <button ng-show="userRole=='admin' && car.approvalStatus!=2" class="btn btn-primary" ng-click="verify(car.id, true)"><i class="icon-ok"></i> 审核通过</button>
        <button ng-show="userRole=='admin' && car.approvalStatus!=2" class="btn btn-danger" ng-click="verify(car.id, false)"><i class="icon-remove"></i> 审核不通过</button>
        <button class="btn btn-inverse" ng-show="userRole=='admin' && car.valid" ng-click="addBlack(car.id)"><i class="icon-ban-circle"></i>加入黑名单</button>
        <button class="btn btn-inverse" ng-show="userRole=='admin' && !car.valid" ng-click="cancelBlack(car.id)"><i class="icon-ban-circle"></i>取消黑名单</button>
        <button class="btn btn-inverse" ng-show="userRole=='admin' || userRole=='carrier'" ng-click="deleteMe(car.id)"><i class="icon-ban-circle"></i>删除</button>
        <div class="btn-group">
            <button ng-show="car.approvalStatus<2 || driver.approvalStatus==3 || userRole=='admin'" class="btn btn-primary" ng-click="enableEdit()">修改资料</button>
        </div>
    </div>
    <div class="well" >
        <form class="form-horizontal" ng-submit="processForm()">
            <fieldset>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">车牌号</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.vehicleNumber">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">挂车号</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.trailerNumber">
                        <p class="help-block"></p>
                    </div>
                </div>

                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">车辆识别代号</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.vehicleLicenseNumber">
                        <p class="help-block"></p>
                    </div>
                </div>

                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">车辆型号</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.model">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">车辆产权证号</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.vehicleOwnershipCertificateNumber">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">车辆载重</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.capacity">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">挂靠企业名称</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.employer">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">备注1</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.reserved1">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">备注2</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.reserved2">
                        <p class="help-block"></p>
                    </div>
                </div>


                <div class="control-group">
                    <!-- Text input-->
                    <label class="control-label" for="input01">备注3</label>
                    <div class="controls">
                        <input type="text" ng-readonly="!editing" class="input-xlarge" ng-model="car.reserved3">
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group" ng-show="editing">
                    <label class="control-label">上传行驶证</label>
                    <div class="controls">
                        <input type="text" id="xingshi" placeholder="" class="input-large" style="display: none"/>
                        <image id="xingshiImg" style="display: none;" width="30" height="40"></image>
                        <a style="cursor: hand" onclick="openUpload('xingshi')">上传文件</a>
                    </div>
                </div>

                <div class="control-group" ng-show="editing">
                    <label class="control-label">上传挂靠企业合同</label>
                    <div class="controls">
                        <input type="text" id="gua" placeholder="" class="input-large" style="display: none"/>
                        <image id="gua" style="display: none;" width="30" height="40"></image>
                        <a style="cursor: hand" onclick="openUpload('gua')">上传文件</a>
                    </div>
                </div>
                <div class="control-group" ng-show="editing">
                    <label class="control-label">上传运输许可证</label>
                    <div class="controls">
                        <input type="text" id="yunshu" placeholder="" class="input-large" style="display: none"/>
                        <image id="yunshuImg" style="display: none;" width="30" height="40"></image>
                        <a style="cursor: hand" onclick="openUpload('yunshu')">上传文件</a>
                    </div>
                </div>
                <div class="control-group" ng-show="editing">
                    <label class="control-label">上传保险单合同</label>
                    <div class="controls">
                        <input type="text" id="baoxian" placeholder="" class="input-large" style="display: none"/>
                        <image id="baoxianImg" style="display: none;" width="30" height="40"></image>
                        <a style="cursor: hand" onclick="openUpload('baoxian')">上传文件</a>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label"></label>
                    <!-- Button -->
                    <div class="controls">
                        <button class="btn btn-primary" ng-show="editing && car.approvalStatus!=2" ng-disabled="uploadingLic1 || uploadingLic2 || uploadingLic3" >保存并提交审核</button>
                        <button class="btn btn-primary" ng-show="editing && car.approvalStatus==2" ng-disabled="uploadingLic1 || uploadingLic2 || uploadingLic3" >保存</button>
                    </div>
                </div>

            </fieldset>
            <fieldset>
                <div id="legend" class="">
                    <legend class="">已上传的资料</legend>
                </div>
                <div class="control-group" ng-show="car.vehicleLicenseNumberAttachment">
                    <!-- Text input-->
                    <label class="control-label">行驶证</label>
                    <div class="controls">
                        <a target="_blank" ng-href="/api/{{car.vehicleLicenseNumberAttachment}}">查看附件</a>
                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group" ng-show="car.assuranceAttachment">
                    <!-- Text input-->
                    <label class="control-label">保险单合同</label>
                    <div class="controls">
                        <a target="_blank" ng-href="/api/{{car.assuranceAttachment}}">查看附件</a>

                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group" ng-show="car.employerAttachment">
                    <!-- Text input-->
                    <label class="control-label">挂靠企业合同</label>
                    <div class="controls">
                        <a target="_blank" ng-href="/api/{{car.employerAttachment}}">查看附件</a>

                        <p class="help-block"></p>
                    </div>
                </div>
                <div class="control-group" ng-show="car.vehicleOwnershipCertificateNumberAttachment">
                    <!-- Text input-->
                    <label class="control-label">运输许可证</label>
                    <div class="controls">
                        <a target="_blank" ng-href="/api/{{car.vehicleOwnershipCertificateNumberAttachment}}">查看附件</a>

                        <p class="help-block"></p>
                    </div>
                </div>
            </fieldset>
        </form>
        <script>
            function openUpload(inputid){
                var url = "../views/upload.html?id="+ inputid;
                var iWidth=400; //弹出窗口的宽度;
                var iHeight=300; //弹出窗口的高度;
                var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
                var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
                window.open(url,'uploadwindow','height='+iHeight+',width='+iWidth+',top='+iTop+',left='+ iLeft +',toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
            }
        </script>
    </div>
</div>
